package com.woniu.form;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import javax.validation.constraints.*;
import java.io.Serializable;
import java.math.BigDecimal;

/**
 * @author jiang
 */
@Data
@ApiModel(value = "购物车商品")
public class ProductForm implements Serializable {
    private static final long serialVersionUID = 1L;
    @ApiModelProperty(value = "商家商品编号")
    @NotNull(message = "商家商品编号不能为空")
    @Pattern(regexp = "^[1-9]\\d*$", message = "商家商品编号只能为正数")
    private String productId;
    @ApiModelProperty(value = "商品数量")
    @Pattern(regexp = "^[1-9]\\d*$", message = "商品数量只能为正数")
    private String count;
    @ApiModelProperty(value = "商品单价")
    @NotNull(message = "商品单价不能为空")
    @DecimalMin(value = "0.01", inclusive = false, message = "商品单价必须大于0.00")
    @Digits(integer = 10, fraction = 2, message = "商品单价最多允许10位整数和2位小数")
    private String price;
    @ApiModelProperty(value = "商品总价")
    @NotNull(message = "商品总价不能为空")
    @DecimalMin(value = "0.01", inclusive = false, message = "商品总价必须大于0.00")
    @Digits(integer = 10, fraction = 2, message = "商品总价最多允许10位整数和2位小数")
    private BigDecimal totalPrice;
    @ApiModelProperty(value = "商品折扣")
    @NotNull(message = "商品折扣不能为空")
    @DecimalMin(value = "0.1", inclusive = false, message = "商品折扣必须大于0.0")
    @DecimalMax(value = "1.1", inclusive = false, message = "商品折扣必须小于1.0")
    @Digits(integer = 1, fraction = 1, message = "商品折扣最多允许1位小数")
    private double disCount;
    @ApiModelProperty(value = "商品折扣后价格")
    @NotNull(message = "商品折扣后价格不能为空")
    private BigDecimal disTotalPrice;
    @ApiModelProperty(value = "商品图片")
    private String storeProductImg;
}
